package com.test.prolenders.bean_prolenders.userinfo_prolenders;

import android.text.TextUtils;

import com.google.gson.Gson;

import org.json.JSONObject;


/**
 * 用户登录信息，只在用户手动登录时获取，自动登录不获取
 */
public class LoginInfo_prolenders {

    private static class Inner {
        private static LoginInfo_prolenders instance = new LoginInfo_prolenders();
    }

    private LoginInfo_prolenders(){}

    public static LoginInfo_prolenders getInstance(){
        return Inner.instance;
    }

    private String type,token,userId,isAdSource;

    public static void parse(JSONObject objJson){
        Inner.instance = new Gson().fromJson(objJson.toString(), LoginInfo_prolenders.class);
    }

    public String getToken() {
        if (TextUtils.isEmpty(token)) return "";
        return token;
    }

    public String getUserId() {
        if (TextUtils.isEmpty(userId)) return "";
        return userId;
    }

    public String getType() {
        if (TextUtils.isEmpty(type)) return "";
        return type;
    }

    public boolean getIsAdSource() {
        if (TextUtils.isEmpty(isAdSource)) return false;
        return isAdSource.equalsIgnoreCase("YES");
    }

}
